package com.xiaoxing.zhinenghuacangku.mvp.model;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.xiaoxing.zhinenghuacangku.mvp.contract.OutOfTheLibraryContract;
import com.xiaoxing.zhinenghuacangku.mvp.model.service.ZhiNengCangKuService;

import java.util.Map;

import javax.inject.Inject;

import io.reactivex.Observable;


@ActivityScope
public class OutOfTheLibraryModel extends BaseModel implements OutOfTheLibraryContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public OutOfTheLibraryModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<String> searchOutStorageListAutoStore(String userPhone, String uid) {
        return mRepositoryManager.obtainRetrofitService(ZhiNengCangKuService.class).searchOutStorageListAutoStore(userPhone, uid);
    }

    @Override
    public Observable<String> returnMaterialAutoStore(String out_storageList_id, String mid, String uid) {
        return mRepositoryManager.obtainRetrofitService(ZhiNengCangKuService.class).returnMaterialAutoStore(out_storageList_id, mid, uid);
    }

    @Override
    public Observable<String> callAutoMachineGetMaterial(String out_storagelist_batchid, String uid) {
        return mRepositoryManager.obtainRetrofitService(ZhiNengCangKuService.class).callAutoMachineGetMaterial(out_storagelist_batchid, uid);

    }


    @Override
    public Observable<String> outStoreForAndroidAuto(String uid, String mid, String out_storageList_id, String bufferId, String taskId) {
        return mRepositoryManager.obtainRetrofitService(ZhiNengCangKuService.class).outStoreForAndroidAuto(uid, mid, out_storageList_id, bufferId, taskId);
    }

    @Override
    public Observable<String> returnMaterialAllAutoStore(String uid, String mid, String out_storageList_id, String bufferId, String taskId) {
        return mRepositoryManager.obtainRetrofitService(ZhiNengCangKuService.class).returnMaterialAllAutoStore(uid, mid, out_storageList_id, bufferId, taskId);
    }

    @Override
    public Observable<String> UpdateOutStorageListBackStatus(String out_storageList_id, String backStatus) {
        return mRepositoryManager.obtainRetrofitService(ZhiNengCangKuService.class).UpdateOutStorageListBackStatus(out_storageList_id, backStatus);

    }

    @Override
    public Observable<String> UpdateOutStorageListScanBufferStatus(String out_storageList_id, String bufferStatus, String bufferId) {
        return mRepositoryManager.obtainRetrofitService(ZhiNengCangKuService.class).UpdateOutStorageListScanBufferStatus(out_storageList_id, bufferStatus, bufferId);

    }

    @Override
    public Observable<String> UpdateOutStorageListScanMaterialStatus(String out_storageList_id, String mStatus, String mid) {
        return mRepositoryManager.obtainRetrofitService(ZhiNengCangKuService.class).UpdateOutStorageListScanMaterialStatus(out_storageList_id, mStatus, mid);

    }

    @Override
    public Observable<String> UpdateOutStorageListOutStatus(String out_storageList_id, String outStatus) {
        return mRepositoryManager.obtainRetrofitService(ZhiNengCangKuService.class).UpdateOutStorageListOutStatus(out_storageList_id, outStatus);

    }

    @Override
    public Observable<String> resetOutStorageListScanStatus(Map<String, String> params) {
        return mRepositoryManager.obtainRetrofitService(ZhiNengCangKuService.class).resetOutStorageListScanStatus(params);

    }

    @Override
    public Observable<String> finishErrorTask(String out_storageList_id) {
        return mRepositoryManager.obtainRetrofitService(ZhiNengCangKuService.class).finishErrorTask(out_storageList_id);

    }
}